<?php 
include TMPL_PATH.'public/header.phtml';
?>
<script src="/statics/js/plugins/artDialog/jquery.artDialog.js?skin=default"></script>
<script src="/statics/js/plugins/artDialog/plugins/iframeTools.js"></script>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
        <a href='<?php echo U('attribute/model_list');?>'><em>产品类型管理</em></a><span>|</span>
        <a href='javascript:;' class="on"><em><?php echo $model_name;?>-属性列表</em></a><span>|</span>
        <a href='<?php echo U('attribute/attribute_add', array('modelid'=>$modelid));?>' ><em>添加 <?php echo $model_name;?> 属性</em></a>
		<span>|</span><a href="javascript:quick_add();" class="on" style="margin-left:50px;">快速添加</a>
    </div>
</div>
<script type="text/javascript">
function quick_add(){
	art.dialog.data('width', 700);
	art.dialog.data('height', 450);
	art.dialog.open('<?php echo U('attribute/attribute_list_relation',array('modelid'=>$_GET['modelid'],'attrid'=>$_GET['attrid']))?>',{lock:true,title:'快速添加',width:600,height:400,yesText:'关闭',background: '#000',opacity: 0.45});
	
}
</script>
<div class="pad_10">
<div class="table-list">
    <table width="100%" cellspacing="0" >
        <thead>
            <tr>
            <th width="50">ID</th>
            <th align='left' width="100">属性名称</th>
            <th align='center' width="160">产品类型</th>
            <th align='center' width="120">属性值的录入方式</th>
            <th align='center' width="80">销售属性</th>
            <th align='center' width="80">高级属性</th>
            <th align='center' width="80">设计师属性</th>
						<th align='center' width="80">属性值个数</th>
            <th align='center' width="80">排序</th>
						<th >管理操作</th>
            </tr>
        </thead>
     <tbody>
   <?php 
   	if(isset($attributeList) && $attributeList):
   		$displayType = AttributeModel::$inputType;
   		foreach ($attributeList as $v):
   ?>
			<tr>
					<td align='center'><?php echo $v['attr_id']?></td>
					<td><?php echo $v['name']?></td>
					<td align='center'><?php echo $v['model_name'];?></td>
					<td align='center'><?php echo $displayType[$v['attr_input_type']];?></td>
					<td align='center'><?php echo $v['attr_sell'] ? '<font color="red">是</font>' : '否';?></td>
					<td align='center'><?php if($v['attr_advanced'] == 1){ echo '<font color="red">是</font>';}else{ echo '否';};?></td>
					<td align='center'><?php echo $v['attr_designer'] ? '<font color="red">是</font>' : '否';?></td>
					<td align='center'><?php echo $v['attribute_values_count']?></td>
					<td align='center'><?php echo $v['sort_order']?></td>
					<td align='center' > 
					<?php if($v['attr_input_type']==AttributeModel::ATTR_OPTIONAL):?>
					<a href="<?php echo U('attribute/attribute_values_list', array('modelid'=>$modelid,'attrid'=>$v['attr_id']));?>">属性值列表</a>&nbsp;&nbsp;|&nbsp;&nbsp;
					<?php endif;?>
					<a href="<?php echo U('attribute/attribute_edit', array('modelid'=>$modelid,'attrid'=>$v['attr_id']));?>">修改</a>&nbsp;&nbsp;|&nbsp;&nbsp;
					<a href="javascript:confirmurl('<?php echo U('attribute/attribute_delete', array('modelid'=>$modelid,'attrid'=>$v['attr_id']));?>','确认要删除吗？')">删除</a>
					</td>
				</tr>
	<?php 
		endforeach;
		endif;
	?>
   </tbody>
    </table>
</div>
</div>
</body>
</html>
<script type="text/javascript">
<!--
	function edit(modelid, attrid, name) {
		window.top.art.dialog({title:'修改属性', id:'edit', iframe:'<?php echo U('attribute/attribute_edit');?>&modelid='+modelid+'&attrid='+attrid ,width:'600px',height:'400px'}, 	function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;
		var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()});
	}
function add(modelid) {
	window.top.art.dialog({title:'添加 属性', id:'add', iframe:'<?php echo U('attribute/attribute_add');?>&modelid='+modelid ,width:'600px',height:'400px'}, 	function(){var d = window.top.art.dialog({id:'add'}).data.iframe;
	var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'add'}).close()});
}
//-->
</script>